package com.excilys.formation.projet.ebanking.dao.impl;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.excilys.formation.projet.ebanking.dao.api.IOperationTypeDao;
import com.excilys.formation.projet.ebanking.modele.OperationType;

public class OperationTypeDaoImpl extends HibernateDaoSupport implements IOperationTypeDao {
	
	@Override
	public OperationType getOperationTypeByCode(String code) {
		Criteria critere = getSession().createCriteria(OperationType.class);
		critere.add(Restrictions.eq("code", code));
		return (OperationType) critere.uniqueResult();
	}
	
}
